namespace Management.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class CreateTableAboutEquipment : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.AdministrationAreas",
                c => new
                    {
                        AdministrationAreaID = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false),
                        Created_at = c.DateTime(nullable: false),
                        Updated_at = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.AdministrationAreaID);
            
            CreateTable(
                "dbo.EquipmentAreas",
                c => new
                    {
                        EquipmentAreaID = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false),
                        ProcessID = c.Int(nullable: false),
                        Remark = c.String(),
                        Created_at = c.DateTime(nullable: false),
                        Updated_at = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.EquipmentAreaID);
            
            CreateTable(
                "dbo.EquipmentFiles",
                c => new
                    {
                        EquipmentFileID = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false),
                        Specification = c.String(nullable: false),
                        genre = c.String(nullable: false),
                        AreaID = c.Int(nullable: false),
                        DepartmentID = c.Int(nullable: false),
                        WorkshopID = c.Int(nullable: false),
                        ProcessID = c.Int(nullable: false),
                        Manufacturer = c.String(nullable: false),
                        IsAlwaysShutdown = c.Int(nullable: false),
                        ShutdownReason = c.String(nullable: false),
                        DailyOutput = c.Decimal(nullable: false, precision: 18, scale: 2),
                        SpecificationID = c.Int(nullable: false),
                        IsDisabled = c.Int(nullable: false),
                        Remark = c.String(),
                    })
                .PrimaryKey(t => t.EquipmentFileID);
            
            CreateTable(
                "dbo.Workshops",
                c => new
                    {
                        WorkshopID = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false),
                        ManufacturingID = c.Int(nullable: false),
                        SubID = c.Int(nullable: false),
                        IsDisabled = c.Int(nullable: false),
                        Created_at = c.DateTime(nullable: false),
                        Updated_at = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.WorkshopID);
            
            AddColumn("dbo.AdminRoles", "Created_at", c => c.DateTime(nullable: false));
            AddColumn("dbo.AdminRoles", "Updated_at", c => c.DateTime(nullable: false));
            AddColumn("dbo.RolePermissions", "Created_at", c => c.DateTime(nullable: false));
            AddColumn("dbo.RolePermissions", "Updated_at", c => c.DateTime(nullable: false));
        }
        
        public override void Down()
        {
            DropColumn("dbo.RolePermissions", "Updated_at");
            DropColumn("dbo.RolePermissions", "Created_at");
            DropColumn("dbo.AdminRoles", "Updated_at");
            DropColumn("dbo.AdminRoles", "Created_at");
            DropTable("dbo.Workshops");
            DropTable("dbo.EquipmentFiles");
            DropTable("dbo.EquipmentAreas");
            DropTable("dbo.AdministrationAreas");
        }
    }
}
